!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define("rb_wixui.thunderbolt[TextInput]",["react"],t):"object"==typeof exports?exports["rb_wixui.thunderbolt[TextInput]"]=t(require("react")):e["rb_wixui.thunderbolt[TextInput]"]=t(e.React)}("undefined"!=typeof self?self:this,(function(e){return function(){var t={5329:function(t){"use strict";t.exports=e},448:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;te.map((e=>e?`wixui-${e}`:"")).join(" "),s=13,u=27;function d(e){return t=>{t.keyCode===e&&(t.preventDefault(),t.stopPropagation(),t.currentTarget.click())}}d(32),d(s),d(u);const p=({size:e,...t})=>n.createElement("svg",{viewBox:"0 0 20 20",fill:"currentColor",width:e||"20",height:e||"20",...t},n.createElement("path",{fillRule:"evenodd",d:"M9.5,3 C13.084,3 16,5.916 16,9.5 C16,13.084 13.084,16 9.5,16 C5.916,16 3,13.084 3,9.5 C3,5.916 5.916,3 9.5,3 Z M9.5,4 C6.467,4 4,6.467 4,9.5 C4,12.533 6.467,15 9.5,15 C12.533,15 15,12.533 15,9.5 C15,6.467 12.533,4 9.5,4 Z M10,11 L10,12 L9,12 L9,11 L10,11 Z M10,7 L10,10 L9,10 L9,7 L10,7 Z"}));p.displayName="ErrorSmall";var c=p,f="TLWrjM",m="GIPQqH",h="JNgJbf";const v=e=>{let{errorMessage:t,errorMessageType:r,shouldShowValidityIndication:a,translations:o,dataHook:i,componentViewMode:l}=e;const s="editor"===l?(null==o?void 0:o.errorMessage)||"Error text displays here.":t;return"inline"===r&&a&&s?n.createElement("div",{"data-hook":i||"inline-error-message",className:f},n.createElement(c,{className:m}),n.createElement("span",{className:h},s)):null};var y={root:"text-input",inputEl:"text-input__input",inputLabel:"text-input__label"},b={input:"KvoMHf",hideNumberSpinner:"ErucfC",AppsTextInputSkin:"MpKiNN",appsTextInputSkin:"MpKiNN",inputWrapper:"pUnTVX",prefix:"eXvLsN","validation-indication":"LyB02C",validationIndication:"LyB02C",label:"wPeA6j",hasLabel:"qzvPmW","required-indication":"lPl_oN",requiredIndication:"lPl_oN",ResponsiveTextInputSkin:"ZXdXNL",responsiveTextInputSkin:"ZXdXNL",keepInputHeight:"Bedjyp"};const g="Please enter a phone number with {digits} digits",x="Please enter between 4 to 17 digits. You can include hyphens (-) or start with a (+), e.g., 555-123-4567 or +(222)987654321",I="Please enter between 4 to 17 digits. You can include dividers (-), e.g., 555-123-4567.",E=function(e,t,n){void 0===n&&(n=!0);return Array.from(t).reduce(((e,t,n)=>"-"===t?[...e,n]:e),[]).filter(((t,r)=>n?t<=e.length:t<=e.length+r))},C=(e,t)=>t.replace("{digits}",""+(e?e.replace(/-/g,"").length:0)),M=()=>{},_=(e,r)=>{var a;const{skin:o,name:s,id:u,className:d="",customClassNames:p=[],dataTestId:c,value:f,inputType:m="text",label:h,placeholder:_,readOnly:L,required:N,isDisabled:O,pattern:T,autoComplete:V,autoComplete_:w,maxLength:P,min:S,max:A,step:F,numberSpinnerHidden:j,shouldShowValidityIndication:R,isValid:k,autoFocus:D,prefix:H,phoneFormat:q="",errorMessageType:B="tooltip",validateValue:X=M,setValidityIndication:Z=M,onBlur:K=M,onFocus:U=M,onKeyPress:W=M,onInput:z=M,onValueChange:G=M,onChange:J=M,onClick:Y=M,onDblClick:$=M,onMouseEnter:Q=M,onMouseLeave:ee=M,ariaAttributes:te,contentRef:ne,translations:re,componentViewMode:ae,keepInputHeightEnabled:oe,textInputAutoFillFixEnabled:ie}=e,le=n.useRef(null);n.useImperativeHandle(r,(()=>({focus:()=>{var e;null==(e=le.current)||e.focus()},blur:()=>{var e;null==(e=le.current)||e.blur()},setCustomValidity:t=>{var n,r;"message"===t.type?null==(n=le.current)||n.setCustomValidity(t.message):null==(r=le.current)||r.setCustomValidity(((e,t)=>{let{translations:n,phoneFormat:r}=t;switch(e.key){case"PHONE_FORMAT_LENGTH_VALIDATION_ERROR":return C(r,(null==n?void 0:n.phoneFormatLengthValidationError)||g);case"PHONE_FORMAT_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatDefaultValidationError)||x;case"PHONE_FORMAT_COMPLEX_PHONE_DEFAULT_VALIDATION_ERROR":return(null==n?void 0:n.phoneFormatComplexPhoneDefaultValidationError)||I;default:return e.key}})(t,{translations:e.translations,phoneFormat:e.phoneFormat}))},getValidationMessage:()=>{var e;return null==(e=le.current)?void 0:e.validationMessage}})));const[se,ue]=n.useState(),de=n.useMemo((()=>"tel"===m&&q?((e,t)=>{const n=E(e,t,!1),r=Array.from(e);return n.forEach((e=>{e{let{shouldSetValidityIndication:t,shouldCallOnInput:n}=e;return e=>{const{value:r}=e.target;let a=r;if(q){const e=r.length{const r=E(e,t);return r.reduce(((t,a,o)=>{if(" "===e[a])t.splice(a-o,1);else if(" "!==e[a+1]||n)" "===e[a-1]&&n&&(e.split(" ").length-1{ce.current.value=f}),[f]),n.useEffect((()=>{var e;ce.current.value=(null==(e=le.current)?void 0:e.value)||"",setTimeout((()=>{pe({shouldSetValidityIndication:!0,shouldCallOnInput:!1})({target:{value:ce.current.value}})}),0)}),[]);const fe=i(b[o],d,l(y.root,...p),{[b.hasLabel]:!!h,[b.requiredIndication]:N,[b.validationIndication]:!!R},oe?b.keepInputHeight:null),{"aria-label":me,...he}=(({pressed:e,expanded:t,haspopup:n,label:r,live:a,relevant:o,current:i,owns:l,controls:s,roleDescription:u,hidden:d,disabled:p,describedBy:c,labelledBy:f,errorMessage:m,atomic:h,role:v,busy:y,...b}={})=>{const g=b.tabIndex??b.tabindex,x={};return r&&(x["aria-label"]=r),a&&(x["aria-live"]=a),i&&(x["aria-current"]=i),e&&(x["aria-pressed"]=e),"boolean"==typeof d&&(x["aria-hidden"]=d),"boolean"==typeof t&&(x["aria-expanded"]=t),"boolean"==typeof p&&(x["aria-disabled"]=p),"boolean"==typeof h&&(x["aria-atomic"]=h),"boolean"==typeof y&&(x["aria-busy"]=y),"string"==typeof o&&(x["aria-relevant"]=o),"string"==typeof l&&(x["aria-owns"]=l),"string"==typeof s&&(x["aria-controls"]=s),"string"==typeof u&&(x["aria-roledescription"]=u),n&&(x["aria-haspopup"]=n),"number"==typeof g&&(x.tabIndex=g),v&&(x.role=v),c&&(x["aria-describedby"]=c),f&&(x["aria-labelledby"]=f),m&&(x["aria-errormessage"]=m),x})(te);return n.createElement("div",t()({id:u},(e=>Object.entries(e).reduce(((e,[t,n])=>(t.includes("data-")&&(e[t]=n),e)),{}))(e),{ref:ne},!oe&&{className:fe},{"data-testid":c,onClick:e=>{O||Y(e)},onDoubleClick:e=>{O||$(e)},onMouseEnter:e=>{O||Q(e)},onMouseLeave:e=>{O||ee(e)}}),n.createElement(...oe?["div",{className:fe}]:[n.Fragment,{}],n.createElement(n.Fragment,null,!!h&&n.createElement("label",{htmlFor:"input_"+u,className:i(b.label,l(y.inputLabel))},h),n.createElement("div",{className:b.inputWrapper},H&&n.createElement("div",{className:b.prefix},H),n.createElement("input",t()({name:s,ref:le,id:"input_"+u,className:i(b.input,"has-custom-focus",l(y.inputEl),{[b.hideNumberSpinner]:j}),type:m,value:de,onFocus:U,onKeyDown:W,onChange:pe({shouldSetValidityIndication:!0,shouldCallOnInput:!0}),onBlur:e=>{K(e),se&&J({...e,type:"change"}),ue(!1),Z(!0)},placeholder:_,readOnly:L,required:N,"aria-required":N,"aria-invalid":R?!k:void 0,pattern:T,maxLength:(()=>{let e=null===P?void 0:P;return q&&(e=q.length),e})(),minLength:q?q.length:void 0,disabled:O,autoComplete:V?"on":w||"off",step:null===F?void 0:F,min:null===S?void 0:S,max:null===A?void 0:A,autoFocus:D,"aria-label":me||h?me:_},he))))),n.createElement(v,{errorMessageType:B,errorMessage:null==(a=le.current)?void 0:a.validationMessage,shouldShowValidityIndication:R,translations:re,componentViewMode:ae}))};const L=e=>e.replace(/([A-Z])/g,(e=>`-${e.toLowerCase()}`));var N;const O={TextInput:{component:n.forwardRef(_),controller:(N=e=>{let{mapperProps:t,controllerUtils:n}=e;return{...t,...(r=n.updateProps,{onValueChange:e=>{r({value:e})},setValidityIndication:e=>{r({shouldShowValidityIndication:e})}})};var r},{useComponentProps:(e,t,n)=>{const r=(e=>({...e,updateStyles:t=>{const n=Object.entries(t).reduce(((e,[t,n])=>{return{...e,[(r=t,r.startsWith("--")?t:L(t))]:void 0===n?null:n};var r}),{});e.updateStyles(n)}}))(n);return N({mapperProps:e,stateValues:t,controllerUtils:r})}})}}}(),a}()})); //# sourceMappingURL=https://static.parastorage.com/services/editor-elements-library/dist/thunderbolt/rb_wixui.thunderbolt[TextInput].3dd071f2.bundle.min.js.map